// 请求地址
import {strategy} from "sharp";

const apiHostUrl :string = process.env.API_HOST_URL ? process.env.API_HOST_URL:"https://mock.apipost.net/mock/403440d5ace0000"

export const strategyArmory = (strategyId:number)=>{
    return fetch(`${apiHostUrl}/api/v1/raffle/strategy_armory?strategyId=${strategyId}`,{
        method:'get',
        headers:{
            'Content-Type':'application/json;charset=utf-8'
        }
    });
}

export const queryRaffleAwardList = (strategyId?:number)=>{
    try{
        return fetch(`${apiHostUrl}/api/v1/raffle/query_raffle_award_list`,{
            method:'POST',
            headers:{
                'Content-Type':'application/json;charset=utf-8'
            },
            body:JSON.stringify({strategyId:strategyId})
        });
    }catch (error) {
        return fetch("{\n" +
            "\"code\":\"0001\",\n" +
            "\"info\":\"调用失败\",\n" +
            "\"data\":[]\n" +
            "}");
    }
}

export const randomRaffle = (strategyId?:number)=>{
    try{
        return fetch(`${apiHostUrl}/api/v1/raffle/random_raffle?strategyId=${strategyId}`,{
            method:'POST',
            headers:{
                'Content-Type':'application/json;charset=utf-8'
            },
            body:JSON.stringify({strategyId:strategyId})
        });
    }catch (error) {
        return fetch("{\n" +
            "\"code\":\"0001\",\n" +
            "\"info\":\"调用失败\",\n" +
            "\"data\":[]\n" +
            "}");
    }
}